package com.zfzs.post.modules.agent.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;

/**
 * 用户余额数量
* @author ck
* @date 2019-08-07
*/
@Entity
@Data
@Table(name="agent_money")
public class AgentMoney implements Serializable {

    // 所属用户
    @Id
    @Column(name = "id")
    private Long id;

    //用于更新操作锁
    @Column(name = "version")
    private Long version;

    // 总余额
    @Column(name = "total_money")
    private BigDecimal totalMoney;

    // 可用余额
    @Column(name = "usable_money")
    private BigDecimal usableMoney;

    // 冻结余额
    @Column(name = "frozen_money")
    private BigDecimal frozenMoney;

    // 录入时间
    @Column(name = "create_time")
    private Timestamp createTime;

    // 修改时间
    @Column(name = "update_time")
    private Timestamp updateTime;

    //提现 0：正常 1：封禁
    @Column(name = "status")
    private Long status;

    public void copy(AgentMoney source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}